package com.framework.web.bus.service;
import com.framework.web.bus.domain.Commentinfo;
import com.framework.web.bus.repository.CommentinfoRepository;
import com.framework.web.bus.repository.specifications.CommentinfoSpecs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

/**
* @Title: Service
* @Description: 业务层
* @author laowang
* @date 2016-09-07
* @version V1.0
*
*/
@Service
public class CommentinfoService {

@Autowired
private CommentinfoRepository  commentinfoRepository;

/**
* 新增或者保存
* @param commentinfo
* @return
*/
public Commentinfo save(Commentinfo commentinfo) {
    return commentinfoRepository.save(commentinfo);
}

/**
* 删除
* @param id
*/
public void  delete(String id) {
    commentinfoRepository.delete(id);
}
/**
* 根据id查询
* @param id
* @return
*/
public Commentinfo findById(String id) {
    return commentinfoRepository.findOne(id);
}


/**
* 分页查找
* @param commentinfo
* @param pr
* @return
*/
public Page<Commentinfo> getPageList(Commentinfo commentinfo, PageRequest pr) {
    Page<Commentinfo> totalList = commentinfoRepository.findAll(CommentinfoSpecs.pageQueryCommentinfo(commentinfo), pr);
    return totalList;
}

}
